package com.itheima.controller;

import com.itheima.common.pojo.Result;
import com.itheima.common.vo.SetmealDto;
import com.itheima.common.vo.SetmealVo;
import com.itheima.service.SetmealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("setmeal")
public class SetmealController {

    @Autowired
    private SetmealService setmealService;

    @GetMapping("/list")
    public Result list(@RequestParam("categoryId") String categoryId,
                       @RequestParam("status") Integer status){

        List<SetmealDto> getlist = setmealService.getlist(categoryId, status);
        return Result.success(getlist);
    }

    @GetMapping("/dish/{id}")
    public Result getById(@PathVariable("id") String id){
        SetmealVo byId = setmealService.getById(id);
        return Result.success("",byId);
    }
}
